#ifndef SCROLLINGMENU_H_
#define SCROLLINGMENU_H_

#include "objectdraw/objectdraw.h"
#include "Libs/ArrayList.h"
#include "Libs/MyFunctions.h"

class Option
{
	public:
		string text,value;
		int num;
		Option(){}
		Option(string _text, string _value)
		{
			text = _text;
			value = _value;
			num = 0;
		}
		Option(string _text)
		{
			text = _text;
			value = _text;
			num = 0;
		}
		Option(string _text,string _value, int _num)
		{
			text = _text;
			value = _value;
			num = _num;
		}
		Option(string _text, int _num)
		{
			text = _text;
			value = intToString(_num);
			num = _num;
		}
		Option(int _num)
		{
			num = _num;
			text = intToString(num);
			value = text;
		}
};

class ScrollingMenu
{
	private:
		DrawingCanvas *canvas;
		
		ArrayList<Option> data;
		ArrayList<Text *> vLines;
		ArrayList<FilledRect *> bgs;
	
		int topline,curserline;
		int colsize, rowsize, x, y;
		int charwidth,charheight;
		
		OSL_COLOR bgcolor,selcolor,textcolor;
		
	public:
		Option selected;
		int selectedIndex;
		
		void hide();
		void show();
		
		ScrollingMenu(){}
		ScrollingMenu(ArrayList<string> text,ArrayList<string> value , int _x, int _y, int _colsize, int _rowsize, DrawingCanvas* _canvas);
		ScrollingMenu(ArrayList<Option> _data,int _x, int _y, int _colsize, int _rowsize,DrawingCanvas *canvas);
		
		void moveCurserUp();
		void moveCurserDown();
		void scrollDown();
		void scrollUp();
		
		void addOption(Option option);
		void addOption(string text, string value);
		void addOption(string text);
		
		void updateSelected();
		void redraw();
		
		void setTextColor(OSL_COLOR color);
		void setSelColor(OSL_COLOR color);
		void setBgColor(OSL_COLOR color);
		void setOptions(vector<Option> options);
		void setOptions(ArrayList<Option> options);
};

#endif /*SCROLLINGMENU_H_*/
